package top.toptimus.dto.order.orderSync;

import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.util.DateTimeUtil;

import java.util.Date;

/**
 * 合同DTO
 *
 * @author gaoyu
 */
@NoArgsConstructor
@Data
public class ContractDTO {

    private int CONTRACT_ID;

    private String CONTRACT_NO;

    private int CUSTOMER_ID;

    private String ORDER_TYPE_CD;

    private Date CONTRACT_ISSUE_DATE;

    private String CONTRACT_CURRENCY_CD;

    private double CONTRACT_EXCHANGE_RATE;

    private String CONTRACT_TRANSPORT_MODE;

    private Date CONTRACT_DELIVERY_DATE;

    private String CONTRACT_AUDIT_STATUS;

    private String CONTRACT_STATUS;

    private int CARTON_INFO_STATUS;

    private int UNIT_COST_STATUS;

    private int FINANCE_STATUS;

    private int CONTRACT_SYNC_STATUS;

    private int CONTRACT_SYNC_STATUS_MTM;

    private int DEL_FLG;

    private int VERSION;

    private int CREATE_USER_ID;

    private Date CREATE_DATE_TIME;

    private int UPDATE_USER_ID;

    private Date UPDATE_DATE_TIME;


    public ContractDTO(int CUSTOMER_ID, Date CREATE_DATE_TIME, String CONTRACT_NO) {
        this.CONTRACT_NO = CONTRACT_NO;
        this.CUSTOMER_ID = CUSTOMER_ID;
        this.ORDER_TYPE_CD = "ORDER_TYPE-TYPE_20";
        this.CONTRACT_ISSUE_DATE = CREATE_DATE_TIME;
        this.CONTRACT_CURRENCY_CD = "QUOTATION_CURRENCY-USD";
        this.CONTRACT_EXCHANGE_RATE = 6.7;
        this.CONTRACT_TRANSPORT_MODE = "TRANSPORT_MODE-AIR_TRANSPORT";
        this.CONTRACT_DELIVERY_DATE = DateTimeUtil.addDays(CREATE_DATE_TIME, 7);
        this.CONTRACT_AUDIT_STATUS = "AUDIT_STATUS-AUDIT_20";
        this.CONTRACT_STATUS = "ORDER_STATUS-OS_30";
        this.CARTON_INFO_STATUS = 1;
        this.UNIT_COST_STATUS = 0;
        this.FINANCE_STATUS = 0;
        this.CONTRACT_SYNC_STATUS = 0;
        this.CONTRACT_SYNC_STATUS_MTM = 1;
        this.DEL_FLG = 0;
        this.VERSION = 1;
        this.CREATE_USER_ID = 1;
        this.CREATE_DATE_TIME = CREATE_DATE_TIME;
        this.UPDATE_USER_ID = 1;
        this.UPDATE_DATE_TIME = CREATE_DATE_TIME;
    }

    public String buildInsertSQL() {
        return "INSERT INTO c_contract_custom_p (\n" +
                "   CONTRACT_NO,\n" +
                "   CUSTOMER_ID,\n" +
                "   ORDER_TYPE_CD,\n" +
                "   CONTRACT_ISSUE_DATE,\n" +
                "   CONTRACT_CURRENCY_CD,\n" +
                "   CONTRACT_EXCHANGE_RATE,\n" +
                "   CONTRACT_TRANSPORT_MODE,\n" +
                "   CONTRACT_DELIVERY_DATE,\n" +
                "   CONTRACT_AUDIT_STATUS,\n" +
                "   CONTRACT_STATUS,\n" +
                "   CARTON_INFO_STATUS,\n" +
                "   UNIT_COST_STATUS,\n" +
                "   FINANCE_STATUS,\n" +
                "   CONTRACT_SYNC_STATUS,\n" +
                "   CONTRACT_SYNC_STATUS_MTM,\n" +
                "   DEL_FLG,\n" +
                "   VERSION,\n" +
                "   CREATE_USER_ID,\n" +
                "   CREATE_DATE_TIME,\n" +
                "   UPDATE_USER_ID,\n" +
                "   UPDATE_DATE_TIME \n" +
                ")\n" +
                "VALUES\n" +
                "   ( " +
                "       '" + this.CONTRACT_NO + "',\n" +
                "       '" + this.CUSTOMER_ID + "',\n" +
                "       '" + this.ORDER_TYPE_CD + "',\n" +
                "       '" + DateTimeUtil.convertToDate(this.CONTRACT_ISSUE_DATE) + "',\n" +
                "       '" + this.CONTRACT_CURRENCY_CD + "',\n" +
                "       '" + this.CONTRACT_EXCHANGE_RATE + "',\n" +
                "       '" + this.CONTRACT_TRANSPORT_MODE + "',\n" +
                "       '" + DateTimeUtil.convertToDate(this.CONTRACT_DELIVERY_DATE) + "',\n" +
                "       '" + this.CONTRACT_AUDIT_STATUS + "',\n" +
                "       '" + this.CONTRACT_STATUS + "',\n" +
                "       '" + this.CARTON_INFO_STATUS + "',\n" +
                "       '" + this.UNIT_COST_STATUS + "',\n" +
                "       '" + this.FINANCE_STATUS + "',\n" +
                "       '" + this.CONTRACT_SYNC_STATUS + "',\n" +
                "       '" + this.CONTRACT_SYNC_STATUS_MTM + "',\n" +
                "       '" + this.DEL_FLG + "',\n" +
                "       '" + this.VERSION + "',\n" +
                "       '" + this.CREATE_USER_ID + "',\n" +
                "       '" + DateTimeUtil.convertToDate(this.CREATE_DATE_TIME) + "',\n" +
                "       '" + this.UPDATE_USER_ID + "',\n" +
                "       '" + DateTimeUtil.convertToDate(this.UPDATE_DATE_TIME) + "'\n" +
                " )";
    }
}
